<div class='fui-page fui-page-current'>
<div class="fui-content">
		<div class="fui-picture">
				<a style="display: block;" data-nocache="true">
					<img ng-src="{{tomedia(pagedata.vipbg) || '../core/resource/images/nopic.jpg'}}">
				</a>
		</div>
		<div class="fui-cell-group fui-cell-click" style="padding-bottom:0.3rem">
			<div class="fui-cell sm">
				<div class="fui-cell-label" style='width:auto'>购买数量</div>
				<div class="fui-cell-mask noremark" style="margin-right:10px">
					 <div class="fui-number">
						<div class="minus" ng-click="pagedata.minus()">-</div>
						<input class="num" type="tel" name="" value="{{pagedata.post.num}}" readonly="readonly"/>
						<div class="plus" ng-click="pagedata.plus()">+</div>
					</div>
				</div>
			</div>
			<div class="fui-cell sm">
				<div class="fui-cell-label" style='width:auto' >费用合计：</div>
				<div class="fui-cell-text bold" style="color:red"> ￥{{pagedata.fee || '0.00'}}</div>
			</div>
			</div>
		<div class="weui_cells_checkbox" style="margin-top:2rem">
                <div class="fui-cell-label" style="text-align:center;margin:0 auto;padding:0.2rem">
                    <input type="checkbox" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" style="line-height:0.6rem" ng-checked="pagedata.post.checked==true" ng-model="pagedata.post.checked">
					我已阅读并同意《<a ng-click="pagedata.show_xieyi=true" style="color:f60">瓶约协议</a>》
                </div>
        </div>
		<div class="weui_btn_area" style="margin-top:0">
			 <a ng-if="!pagedata.order_id" class="weui_btn weui_btn_primary" style="border-radius:1rem" href="javascript:" id="showTooltips" ng-click="pagedata.buyvip();">提交</a>
			 <a ng-if="pagedata.order_id" class="weui_btn weui_btn_primary" style="border-radius:1rem" href="javascript:" id="showTooltips" ng-click="access_json('jy_ailiao/ping.orderlog/');">查看订单</a>
		</div>
</div>
<div ng-if="pagedata.show_xieyi" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<i class="closed icon icon-cuowu" ng-click="pagedata.show_xieyi=false"></i>
			<div class="content-images" style="padding:0.5rem;height:20rem; overflow-y:scroll;">
					<div class="title bold" style="font-size:0.8rem">{{pagedata.pingxieyi.title || '瓶约协议'}} / <small>Read Ggree</small></div>
					<div class="text" style="padding-top:0.5rem;font-size:0.7rem" ng-bind-html="trust(pagedata.pingxieyi.content)">
					</div>
			</div>
			<div class="modal-footer">
				<div ng-click="pagedata.show_xieyi=false;pagedata.post.checked=1;" class="mod-check" style="width: 100%; margin: 0">我已阅读</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
//购买
scope.pagedata.buyvip=function(){
	if(!scope.pagedata.post.checked){
		scope.message('请先阅读并勾选《瓶约协议》','error');
		return false;
	}
	scope.post_json('jy_ailiao/ping.buyping/post/',scope.pagedata.post,function(result){
		scope.pagedata.order_id=result.order_id;
		var success_url='jy_ailiao/member.index/';
		scope.tool.pay(result.pay_id,function(res){
			if(res.type=='success'){
						scope.message('支付成功！','success',success_url);
			}else{
						scope.message('支付失败！','success',success_url);
			}
		},'','',success_url,success_url);
	})
}
//减少
scope.pagedata.minus=function(){
	if(scope.pagedata.post.num <=1){
		return false;
	}
	scope.pagedata.post.num--;
	scope.pagedata.jisuan(scope.pagedata.post.num);
	return
}
//增加
scope.pagedata.plus=function(){
	scope.pagedata.post.num++;
	scope.pagedata.jisuan(scope.pagedata.post.num);
	return
}
//选择付款类型
scope.pagedata.type=function(){
	scope.pagedata.post.num=1
	scope.pagedata.jisuan(scope.pagedata.post.num);
	return
}
//计算
scope.pagedata.jisuan=function(num){
	scope.pagedata.fee = getprice(scope.pagedata.pingset.oneprice * num *1)
	scope.$evalAsync();
}
function getprice(num)
{
	//var num = parseFloat(num);
	num = num.toFixed(2);
	//console.log(num);
	return num
	
}
</script>
</div>